package com.yeah.spring.springbootstudy.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.yeah.spring.springbootstudy.common.aop.AuditLog;

@RestController
public class HelloController {

	@GetMapping("/")
	public String index() {
		return "Greetings from Spring Boot!";
	}
	
	@AuditLog(module = "TEST", operator="TEST")
	@PostMapping("/aop/post")
	public JSONObject aopPost(@RequestBody JSONObject obj) {
		JSONObject ret = new JSONObject();
		
		ret.put("status", "OK");
		ret.put("message", "succeed");
		ret.put("requestObj", obj.toJSONString());
		
		return ret;
	}

}
